package com.lkl.feign;

import com.lkl.entity.User;
import com.lkl.feign.fallback.UserFallbackFeignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

//fallback参数指定为我们刚刚编写的实现类
@FeignClient(value = "service-user", fallback = UserFallbackFeignClient.class)   //声明为service-user服务的HTTP请求客户端
public interface UserFeignClient {

    @RequestMapping("/user/{uid}") //路径保证和其他微服务提供的一致即可
    User findUserById(@PathVariable("uid") int uid); //参数和返回值也保持一致
}
